﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MapWindow.Data;
using MapWindow.PluginInterfaces;
using MapWindow.Map;
using MapWindow.Components;
using MapWindow.Drawing;

namespace FindCountryPlugin
{
    public partial class QueryForm : Form
    {
        //the mapWin variable used for accessing the map
        private IMapPluginArgs _mapWin;
        
        //the feature set of countries used by the search
        private IMapFeatureLayer _countries;
        
        public QueryForm(IMapFeatureLayer layer, IMapPluginArgs args)
        {
            InitializeComponent();
            _mapWin = args;
            _countries = layer;
        }

        //when the 'find country' button is clicked
        private void button1_Click(object sender, EventArgs e)
        {
            string filter = "NAME = '" + textBox1.Text + "'";
            _countries.SelectByAttribute(filter);
            _mapWin.Map.MapFrame.ResetBuffer();
        }
    }
}
